@echo off

setlocal enabledelayedexpansion

for /F %%i in ("%0") do set CMD=%%~ni
set SCRIPTDIR=%~dp0
set EMBEDDED=%SCRIPTDIR%..\embedded
set BIN=%EMBEDDED%\bin
set FRAMEWORK=%EMBEDDED%\framework

set GEM_HOME=
set GEM_PATH=
set GEM_ROOT=
set RUBY_ENGINE=
set RUBY_ROOT=
set PATH=%BIN%;%PATH%

if exist %FRAMEWORK%\%CMD% (
  ruby %FRAMEWORK%\%CMD% %*
) else (
  ruby %BIN%\%CMD% %*
)

endlocal
